Skip to content

perf(history): retain only requested deletion records - #2246

Merged
tw93 merged 1 commit into
tw93:mainfrom
Yuxin-Qiao:codex/bound-history-deletion-records
Dec 5, 2026
Merged

tw93 merged 1 commit into
tw93:mainfrom
Yuxin-Qiao:codex/bound-history-deletion-records

Conversation

@Yuxin-Qiao

Copy link
Copy Markdown
Contributor

Summary

  • Pass the existing history output limit to the deletion-log reader. Keep only the newest valid records needed by the renderers while reading the entire log.
  • Continue to use the same row parser and chronological order. This follows up on perf(history): parse deletion audit rows in a single read #2113, which reduced per-row parsing work.

Safety Review

  • History reads the original files and keeps the existing text and JSON output. The operation-session parser is unaffected.

Tests

  • Added Bats coverage for ring wraparound, malformed rows, the unterminated last line and the reader's unbounded internal mode.
  • Local full suite passed on the measured baseline and when this patch was combined with independent clean changes on a later main revision. Format and the history Bats suite were rerun on the PR base.
  • Compared text and JSON outputs, including missing final newlines and invalid UTF-8. Also compared the retained rows under Bash 3.2 and 5.3.

Synthetic deletion logs on one arm64 Mac, three runs per version of mo history --json --limit 20 at db8371d0:

Rows Main median Patch median
100 0.043 s 0.043 s
12,000 0.998 s 0.256 s
40,000 9.425 s 0.722 s

@Yuxin-Qiao
Yuxin-Qiao requested a review from tw93 as a code owner December 5, 2026 03:27
@tw93

tw93 commented Dec 5, 2026

Copy link
Copy Markdown
Owner

@Yuxin-Qiao Thanks for eliminating the per-line subprocess forks in mo history! Merged into main.

@tw93
tw93 merged commit 191cb26 into tw93:main Dec 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants